package cn.abcsys.cloud.devops.web.service.impl;

import java.sql.SQLException;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cn.abcsys.cloud.devops.web.dao.UserRoleEnvProjMapper;
import cn.abcsys.cloud.devops.web.entity.UserRoleEnvProj;
import cn.abcsys.cloud.devops.web.service.UserRoleEnvProjService;

@Service
public class UserRoleEnvProjServiceImp implements UserRoleEnvProjService {

	@Resource
	private UserRoleEnvProjMapper userRoleEnvProjMapper;
	@Override
	public int insertEnvManager(UserRoleEnvProj urep) throws SQLException {
		//环境管理员没有项目信息
		//urep.setProjectId(null);
		urep.setRoleId(2);
		return userRoleEnvProjMapper.insertSelective(urep);
	}
	
	@Override
	public int insertProjManager(UserRoleEnvProj urep) throws SQLException {
		urep.setRoleId(3);
		return userRoleEnvProjMapper.insertSelective(urep);
	}
	
	@Override
	public int insertOrdinaryUser(List<UserRoleEnvProj> urepList) throws SQLException {
		// TODO Auto-generated method stub
		//urep.setRoleId(4);
		return userRoleEnvProjMapper.insertListUREJ(urepList);
	}
	
}
